import axios from 'axios';

const instance = axios.create({
  baseURL: 'http://localhost:8081/api',
  timeout: 15000
});

//请求拦截器
instance.interceptors.request.use(config => {
  // 每个请求都必须带上token信息
  config.headers['Authorization'] = sessionStorage.getItem("token");
  return config;
}, err => {
  console.log(err);
  Promise.reject(err);
})

export default instance;
